export default {
    link(str) {
        let url;
        url = location.protocol + '//' + location.host + window.baseUrl + str;
        return url;
    },
    go(url, router) {
        if (router) {
            if (typeof url === 'string') {
                console.log(url);
                router.go({path: url});
            } else {
                router.go(url);
            }
        }
        location.href = this.link(url);
    },

    getUrlKey:function(name){
        return decodeURIComponent((new RegExp('[?|&]'+name+'='+'([^&;]+?)(&|#|;|$)').exec(location.href)||[,""])[1].replace(/\+/g,'%20'))||null;
    }
}
